#ifndef EZVOICEPLAYERMANAGER_H
#define EZVOICEPLAYERMANAGER_H

#include <QObject>
//#include "ezvoiceplayer.h"
#include "playlistbasemodel.h"
#include "player/ezqaudioplayer.h"

class EZVoicePlayerManager : public QObject , public PlayListBaseModelDelegate
{
    Q_OBJECT
public:
    EZVoicePlayerManager(QObject *parent = 0);
    ~EZVoicePlayerManager();

    static EZVoicePlayerManager* defaultManager();

public:
    PlayListBaseModel* getPlayList();
    void setPlayList(PlayListBaseModel *playList);
    void setPlayList(EZTally::EZTallyArray<SongModel*> *songs);

    void playIndex(int index);
    void playNext();
    void playCurrent();
    void playPrevious();
    void playOrPause();

    virtual void onSongChange(PlayListBaseModel */*sender*/,EZTally::EZTallyArray<SongModel*> */*oldSong*/);
private:
    void playSong(SongModel *song,int index = -1);

    bool _willPlayOnSongChange;
private:
//    EZVoicePlayer *player;
    EZQAudioPlayer *_audioPlayer;
    PlayListBaseModel *playList;

public slots:
//    void onPlayStatusChange(EZVoiceState);
    void onAudioPlayerStatusChange(EZQAudioPlayStatus);

signals:
    void sigPlayListContentChange();
    void sigPlayIndexChange(int);
    void sigPlayQueueTypeChange();

private slots:
    friend class PlayListBaseModel;
    void onPlayListQueueTypeChange();
};

#endif // EZVOICEPLAYERMANAGER_H
